<?php
/**
 * Created by PhpStorm.
 * User: root
 * Date: 15-1-5
 * Time: 上午10:32
 */
class NgController extends BaseController
{
    public function getIndex()
    {
        if( ! App::environment('testing') ){
            setcookie('loginData', json_encode( $this->buildLoginData() ), time() + 60, '/');
        }

        return View::make('in');
    }

    protected function buildLoginData()
    {
        $loginData = [
            'personalInfo' => User::with('role')->findOrFail(Auth::user()['id'])->toArray(),
            'uri' => ['login' => URL::to('/authority/login'), 'logout' => URL::to('authority/logout')]
        ];

        return $loginData;
    }
}